//
//  GasCarFunc.m
//  GasCome
//
//  Created by zfc on 2020/5/15.
//  Copyright © 2020 zfc. All rights reserved.
//

#import "GasCarFunc.h"

@implementation GasCarFunc

+(void) judgeContainsGasCarWithCompanyID:(NSString *)companyID completeBlock:(void (^)(BOOL contain, NSString *gasCardID))completeBlock {
    NSString *url = @"/api/tiny-shop/v1/member/account/index";

    [[NetWorksTools shared] requestWithMethod:GET url:url params:nil successBlock:^(NSDictionary * _Nonnull response) {

        for (NSDictionary *dic in  response[@"data"]) {
            if ([dic[@"merchant_id"] intValue] == [companyID intValue]) {
                if (completeBlock) {
                    completeBlock(YES, dic[@"id"]);
                }
                return;
            } else {
                NSLog(@"1");
            }
        }
        
        if (completeBlock) {
            completeBlock(NO, nil);
        }
    } failureBlock:^(NSError * _Nonnull error) {

    }];
}

@end
